home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / baud.arc / BAUD.BAS
Encoding:
BASIC Source File  |  1987-11-01  |  674 b   |  29 lines

  1. ' GetBaud returns the current baud rate in Baud$
  2. ' b% should be set to &h3f8 or &h2f8 for com1: and com2:, respectively.
  3. '
  4. ' Barry Jaspan, 11/01/87
  5.  
  6. GetBaud:
  7.  b%=&h3f8
  8.  dlab%=inp(b%+3)
  9.  dlab%=dlab% or 128
  10.  out b%+3,dlab%    ' Set Divisor Latch Access Bit on
  11.  lsb%=inp(b%)     ' read least significant byte of divisor
  12.  msb%=inp(b%+1)   '  read most significant byte of divisor
  13.  Divisor%=(msb%*255)+lsb%
  14.  dlab%=dlab% and 127
  15.  out b%+3,dlab%  ' Set Divisor Latch Access Bit off
  16.  select case divisor%
  17.   case 383
  18.    baud$="300"
  19.   case 96
  20.    baud$="1200"
  21.   case 48
  22.    baud$="2400"
  23.   case 24
  24.    baud$="4800"
  25.   case 12
  26.    baud$="9600"
  27.  end select
  28. return
  29.